package com.sen.common.widget.table;

import java.util.List;

import org.apache.commons.collections.CollectionUtils;

import com.sen.common.widget.Component;

/**
 * @author sen
 */
public class Table extends Component {

	public Table() {
		this(null);
	}
	
	public Table(String id) {
		super("table");
		this.id(id);
	}
	
	public TableRow row() {
		return row(new TableRow(this));
	}

	public TableRow row(TableRow row) {
		this.add(row);
		return row;
	}
	
	public Table rows(List<TableRow> rows) {
		if (CollectionUtils.isEmpty(rows)) {
			return this;
		}
		for (TableRow row : rows) {
			this.row(row);
		}
		return this;
	}
}
